using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

using SlimDX;
using SlimDX.Direct3D9;

using miciv;
using miciv.Rendering;
using miciv.Geometry;

namespace micivCore.Data
{
    public class UnitRenderableInfo
    {
        protected CoreContext m_coreContext;
        protected IGeometry m_geometry;
        protected Color4 m_f4Diffuse;
        protected TextureManager.ManagedTexture m_albedoTexture;

        public UnitRenderableInfo(CoreContext _coreContext, XmlElement _xmlGeometry)
        {
            this.m_coreContext = _coreContext;
            this.m_geometry = new GeometryBase(this.m_coreContext, _xmlGeometry, typeof(UnitRenderable));
            this.Diffuse = this.m_geometry.GetSemantic<Color4>("DiffuseColor");
            this.Albedo = this.m_geometry.GetSemantic<TextureManager.ManagedTexture>("AlbedoTexture");
        }

        public void Release()
        {
            this.m_geometry.Release();
        }

        public IRenderer Renderer
        {
            get
            {
                return this.m_geometry.Renderer;
            }
        }

        public SlimDX.Color4 Diffuse
        {
            get
            {
                return this.m_f4Diffuse;
            }
            set
            {
                this.m_f4Diffuse = value;
            }
        }

        public TextureManager.ManagedTexture Albedo
        {
            get
            {
                return this.m_albedoTexture;
            }
            set
            {
                this.m_albedoTexture = value;
            }
        }

        public IGeometry Geometry
        {
            get
            {
                return this.m_geometry;
            }
        }
    }
}
